package com.shop.cereshop.commons.enums;

import lombok.Getter;

/**
 * 店铺资质枚举类
 */
@Getter
public enum BusinessTypeEnum {
    QIYE(1,"企业"),
    GEREN(2,"个人"),
    QIJIANDIAN(3,"旗舰店"),
    QITAZUZHI(4,"其他组织")
    ;

    private final Integer code;

    private final String message;
    
    BusinessTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static BusinessTypeEnum getByCode(Integer code) {
        for (BusinessTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static String getMessageByCode(Integer code) {
        for (BusinessTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getMessage();
            }
        }
        return null;
    }

    public static Integer getCodeByMessage(String message) {
        for (BusinessTypeEnum value : values()) {
            if (value.getMessage().equals(message)) {
                return value.getCode();
            }
        }
        return -1;
    }

}
